package orc;

import net.sourceforge.tess4j.Tesseract;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;

/**
 * Created by wrh on 17-9-30.
 */
public class TessRactFactory {

    private static Logger logger = LoggerFactory.getLogger(TessRactFactory.class);

    //文字特征文件所在文件夹
    private static final String LANGUAGE_DATAPATH = TessRactFactory.class.getResource("/").getPath();
//    //最大实例化文字识别对象数量
//    public static final int MAX_NUM_OF_TESSERACT = 10;



    private TessRactFactory(){}

    /**
     * 获取文字识别实例
     * @return
     */
    public static Tesseract getTesseract(){
        Tesseract tesseract=new Tesseract();
        tesseract.setDatapath(LANGUAGE_DATAPATH);
        logger.info("数据路径"+LANGUAGE_DATAPATH);
        tesseract.setLanguage(LanguageName.chi_sim.name());
        return tesseract;
    }

//    /**
//     * 回收
//     * @param tesseract
//     */
//    public static void recycling(Tesseract tesseract){
//        iTesseracts.add(tesseract);
//    }
}
